#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QTimer>

namespace Ui {
class MainWindow;
}

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();
protected:
    bool eventFilter(QObject *watched, QEvent *event);
    void creatFood();
    void drawSnakeHead();
    void init();
    bool dealGuoJie();
    void gameOver();
    void flashgrade();
    void snakeRun();
    void snakeHeadRun();
    void checkEatFood();
    void ungrade();
private slots:
    void painter_rects();
    void on_pushButton_up_clicked();

    void on_pushButton_left_clicked();

    void on_pushButton_right_clicked();

    void on_pushButton_down_clicked();

    void slot_Timerout();

private:
    Ui::MainWindow *ui;


    int snake[100][2];
    int* snakeBody[100][2];
    int foodPosition[2];
    int m_foodCount;
    int m_direction;
    int m_currentGrade;
    int m_currentSpeed;
    QTimer* timer;



};

#endif // MAINWINDOW_H
